<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<title>S110_nRF51822/Include/ble/ble_services/ble_bas.h Source File</title>
<link href="tabs.css" rel="stylesheet" type="text/css" />
<link href="doxygen.css" rel="stylesheet" type="text/css" />
<link href="alias.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="alias.js"></script>

<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<script type="text/javascript">
  $(document).ready(initResizable);
</script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/search.js"></script>
<script type="text/javascript">
  $(document).ready(function() { searchBox.OnSelectItem(0); });
</script>


<script type="text/javascript">
  jQuery(document).ready(function () {
    if(gref){ // Number all _img and _table classes
      gref();
    }
  });
</script>

</head>
<body>
<div id="top"><!-- do not remove this div! -->

<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  
  
  <td style="padding-left: 0.5em;">
   <div id="projectname">nRF51822 BLE SDK
   
   </div>
   
  </td>
  
  
  
 </tr>
 </tbody>
</table>
</div>

<!-- Generated by Doxygen 1.7.5 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>Main&#160;Page</span></a></li>
      <li><a href="modules.html"><span>Modules</span></a></li>
      <li><a href="annotated.html"><span>Data&#160;Structures</span></a></li>
      <li class="current"><a href="files.html"><span>Files</span></a></li>
      <li>
        <div id="MSearchBox" class="MSearchBoxInactive">
        <span class="left">
          <img id="MSearchSelect" src="search/mag_sel.png"
               onmouseover="return searchBox.OnSearchSelectShow()"
               onmouseout="return searchBox.OnSearchSelectHide()"
               alt=""/>
          <input type="text" id="MSearchField" value="Search" accesskey="S"
               onfocus="searchBox.OnSearchFieldFocus(true)" 
               onblur="searchBox.OnSearchFieldFocus(false)" 
               onkeyup="searchBox.OnSearchFieldChange(event)"/>
          </span><span class="right">
            <a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
          </span>
        </div>
      </li>
    </ul>
  </div>
  <div id="navrow2" class="tabs2">
    <ul class="tablist">
      <li><a href="files.html"><span>File&#160;List</span></a></li>
      <li><a href="globals.html"><span>Globals</span></a></li>
    </ul>
  </div>
</div>
<div id="side-nav" class="ui-resizable side-nav-resizable">
  <div id="nav-tree">
    <div id="nav-tree-contents">
    </div>
  </div>
  <div id="splitbar" style="-moz-user-select:none;" 
       class="ui-resizable-handle">
  </div>
</div>
<script type="text/javascript">
  initNavTree('ble__bas_8h.html','');
</script>
<div id="doc-content">
<div class="header">
  <div class="headertitle">
<div class="title">S110_nRF51822/Include/ble/ble_services/ble_bas.h</div>  </div>
</div>
<div class="contents">
<a href="ble__bas_8h.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/* Copyright (c) 2012 Nordic Semiconductor. All Rights Reserved.</span>
<a name="l00002"></a>00002 <span class="comment"> *</span>
<a name="l00003"></a>00003 <span class="comment"> * The information contained herein is property of Nordic Semiconductor ASA.</span>
<a name="l00004"></a>00004 <span class="comment"> * Terms and conditions of usage are described in detail in NORDIC</span>
<a name="l00005"></a>00005 <span class="comment"> * SEMICONDUCTOR STANDARD SOFTWARE LICENSE AGREEMENT.</span>
<a name="l00006"></a>00006 <span class="comment"> *</span>
<a name="l00007"></a>00007 <span class="comment"> * Licensees are granted free, non-transferable use of the information. NO</span>
<a name="l00008"></a>00008 <span class="comment"> * WARRANTY of ANY KIND is provided. This heading must NOT be removed from</span>
<a name="l00009"></a>00009 <span class="comment"> * the file.</span>
<a name="l00010"></a>00010 <span class="comment"> *</span>
<a name="l00011"></a>00011 <span class="comment"> * $LastChangedRevision$</span>
<a name="l00012"></a>00012 <span class="comment"> */</span>
<a name="l00013"></a>00013 
<a name="l00036"></a>00036 <span class="preprocessor">#ifndef BLE_BAS_H__</span>
<a name="l00037"></a>00037 <span class="preprocessor"></span><span class="preprocessor">#define BLE_BAS_H__</span>
<a name="l00038"></a>00038 <span class="preprocessor"></span>
<a name="l00039"></a>00039 <span class="preprocessor">#include &lt;stdint.h&gt;</span>
<a name="l00040"></a>00040 <span class="preprocessor">#include &lt;stdbool.h&gt;</span>
<a name="l00041"></a>00041 <span class="preprocessor">#include &quot;ble.h&quot;</span>
<a name="l00042"></a>00042 <span class="preprocessor">#include &quot;<a class="code" href="ble__srv__common_8h.html">ble_srv_common.h</a>&quot;</span>
<a name="l00043"></a>00043 
<a name="l00045"></a><a class="code" href="group__ble__sdk__srv__bas.html#gab63b7f474ce48636cd355f6b75ea1ca9">00045</a> <span class="keyword">typedef</span> <span class="keyword">enum</span>
<a name="l00046"></a>00046 {
<a name="l00047"></a><a class="code" href="group__ble__sdk__srv__bas.html#ggab63b7f474ce48636cd355f6b75ea1ca9a657f8681ada82fd2990d5458442ed85a">00047</a>     <a class="code" href="group__ble__sdk__srv__bas.html#ggab63b7f474ce48636cd355f6b75ea1ca9a657f8681ada82fd2990d5458442ed85a">BLE_BAS_EVT_NOTIFICATION_ENABLED</a>,                             
<a name="l00048"></a><a class="code" href="group__ble__sdk__srv__bas.html#ggab63b7f474ce48636cd355f6b75ea1ca9afcba4bddb1a583374bb27d3f3ed5b8d1">00048</a>     <a class="code" href="group__ble__sdk__srv__bas.html#ggab63b7f474ce48636cd355f6b75ea1ca9afcba4bddb1a583374bb27d3f3ed5b8d1">BLE_BAS_EVT_NOTIFICATION_DISABLED</a>                             
<a name="l00049"></a>00049 } <a class="code" href="group__ble__sdk__srv__bas.html#gab63b7f474ce48636cd355f6b75ea1ca9" title="Battery Service event type.">ble_bas_evt_type_t</a>;
<a name="l00050"></a>00050 
<a name="l00052"></a>00052 <span class="keyword">typedef</span> <span class="keyword">struct</span>
<a name="l00053"></a>00053 {
<a name="l00054"></a><a class="code" href="structble__bas__evt__t.html#a54dbfc0f61e2602953ac085fa8fb15a9">00054</a>     <a class="code" href="group__ble__sdk__srv__bas.html#gab63b7f474ce48636cd355f6b75ea1ca9" title="Battery Service event type.">ble_bas_evt_type_t</a> <a class="code" href="structble__bas__evt__t.html#a54dbfc0f61e2602953ac085fa8fb15a9">evt_type</a>;                                  
<a name="l00055"></a>00055 } <a class="code" href="structble__bas__evt__t.html" title="Battery Service event.">ble_bas_evt_t</a>;
<a name="l00056"></a>00056 
<a name="l00057"></a>00057 <span class="comment">// Forward declaration of the ble_bas_t type. </span>
<a name="l00058"></a><a class="code" href="group__ble__sdk__srv__bas.html#gaea81f98230816bcfcbfd6ccbb4db3999">00058</a> <span class="keyword">typedef</span> <span class="keyword">struct </span><a class="code" href="structble__bas__s.html" title="Battery Service structure. This contains various status information for the service.">ble_bas_s</a> <a class="code" href="structble__bas__s.html" title="Battery Service structure. This contains various status information for the service.">ble_bas_t</a>;
<a name="l00059"></a>00059 
<a name="l00061"></a><a class="code" href="group__ble__sdk__srv__bas.html#ga07fd95f8afa679110161bb8391496abd">00061</a> <span class="keyword">typedef</span> void (*<a class="code" href="group__ble__sdk__srv__bas.html#ga07fd95f8afa679110161bb8391496abd" title="Battery Service event handler type.">ble_bas_evt_handler_t</a>) (<a class="code" href="structble__bas__s.html" title="Battery Service structure. This contains various status information for the service.">ble_bas_t</a> * p_bas, <a class="code" href="structble__bas__evt__t.html" title="Battery Service event.">ble_bas_evt_t</a> * p_evt);
<a name="l00062"></a>00062 
<a name="l00065"></a>00065 <span class="keyword">typedef</span> <span class="keyword">struct</span>
<a name="l00066"></a>00066 {
<a name="l00067"></a><a class="code" href="structble__bas__init__t.html#a3c25f96941dd8c1b92407ed2994691c6">00067</a>     <a class="code" href="group__ble__sdk__srv__bas.html#ga07fd95f8afa679110161bb8391496abd" title="Battery Service event handler type.">ble_bas_evt_handler_t</a>         <a class="code" href="structble__bas__init__t.html#a3c25f96941dd8c1b92407ed2994691c6">evt_handler</a>;                    
<a name="l00068"></a><a class="code" href="structble__bas__init__t.html#adbf298550acd37c0d6170e90504318ac">00068</a>     <span class="keywordtype">bool</span>                          <a class="code" href="structble__bas__init__t.html#adbf298550acd37c0d6170e90504318ac">support_notification</a>;           
<a name="l00069"></a><a class="code" href="structble__bas__init__t.html#ac3ce984f1c066cfc0911e98fa1acdc8e">00069</a>     <a class="code" href="structble__srv__report__ref__t.html" title="Value of a Report Reference descriptor.">ble_srv_report_ref_t</a> *        <a class="code" href="structble__bas__init__t.html#ac3ce984f1c066cfc0911e98fa1acdc8e">p_report_ref</a>;                   
<a name="l00070"></a><a class="code" href="structble__bas__init__t.html#ae5e656df4b847b3a099792ae32676d16">00070</a>     uint8_t                       <a class="code" href="structble__bas__init__t.html#ae5e656df4b847b3a099792ae32676d16">initial_batt_level</a>;             
<a name="l00071"></a><a class="code" href="structble__bas__init__t.html#ada6a205c81f51d9aa2de33bbdea0bd26">00071</a>     <a class="code" href="structble__srv__cccd__security__mode__t.html" title="Security settings structure.">ble_srv_cccd_security_mode_t</a>  <a class="code" href="structble__bas__init__t.html#ada6a205c81f51d9aa2de33bbdea0bd26">battery_level_char_attr_md</a>;     
<a name="l00072"></a><a class="code" href="structble__bas__init__t.html#a2c9724572f64316880f915bb78882de0">00072</a>     <a class="code" href="structble__gap__conn__sec__mode__t.html" title="GAP link requirements.">ble_gap_conn_sec_mode_t</a>       <a class="code" href="structble__bas__init__t.html#a2c9724572f64316880f915bb78882de0">battery_level_report_read_perm</a>; 
<a name="l00073"></a>00073 } <a class="code" href="structble__bas__init__t.html" title="Battery Service init structure. This contains all options and data needed for initialization of the s...">ble_bas_init_t</a>;
<a name="l00074"></a>00074 
<a name="l00076"></a>00076 <span class="keyword">typedef</span> <span class="keyword">struct </span><a class="code" href="structble__bas__s.html" title="Battery Service structure. This contains various status information for the service.">ble_bas_s</a>
<a name="l00077"></a>00077 {
<a name="l00078"></a><a class="code" href="structble__bas__s.html#a3c25f96941dd8c1b92407ed2994691c6">00078</a>     <a class="code" href="group__ble__sdk__srv__bas.html#ga07fd95f8afa679110161bb8391496abd" title="Battery Service event handler type.">ble_bas_evt_handler_t</a>         <a class="code" href="structble__bas__s.html#a3c25f96941dd8c1b92407ed2994691c6">evt_handler</a>;                    
<a name="l00079"></a><a class="code" href="structble__bas__s.html#a363e00d9262febd8d752ed2f933be1e4">00079</a>     uint16_t                      <a class="code" href="structble__bas__s.html#a363e00d9262febd8d752ed2f933be1e4">service_handle</a>;                 
<a name="l00080"></a><a class="code" href="structble__bas__s.html#a554415e857e1b95eafd8cd7bc70d88e9">00080</a>     <a class="code" href="structble__gatts__char__handles__t.html" title="GATT Characteristic Definition Handles.">ble_gatts_char_handles_t</a>      <a class="code" href="structble__bas__s.html#a554415e857e1b95eafd8cd7bc70d88e9">battery_level_handles</a>;          
<a name="l00081"></a><a class="code" href="structble__bas__s.html#aca91746b5636facbde7795d8825c2a0f">00081</a>     uint16_t                      <a class="code" href="structble__bas__s.html#aca91746b5636facbde7795d8825c2a0f">report_ref_handle</a>;              
<a name="l00082"></a><a class="code" href="structble__bas__s.html#a7e140bc98e49ed99a1b29c8410195884">00082</a>     uint8_t                       <a class="code" href="structble__bas__s.html#a7e140bc98e49ed99a1b29c8410195884">battery_level_last</a>;             
<a name="l00083"></a><a class="code" href="structble__bas__s.html#a0d5ffe38d68e48d81e61fc6a4999ae68">00083</a>     uint16_t                      <a class="code" href="structble__bas__s.html#a0d5ffe38d68e48d81e61fc6a4999ae68">conn_handle</a>;                    
<a name="l00084"></a><a class="code" href="structble__bas__s.html#a36642b08bea41f0d2100e7f18fefbe10">00084</a>     <span class="keywordtype">bool</span>                          <a class="code" href="structble__bas__s.html#a36642b08bea41f0d2100e7f18fefbe10">is_notification_supported</a>;      
<a name="l00085"></a>00085 } <a class="code" href="group__ble__sdk__srv__bas.html#gaea81f98230816bcfcbfd6ccbb4db3999" title="Battery Service structure. This contains various status information for the service.">ble_bas_t</a>;
<a name="l00086"></a>00086 
<a name="l00095"></a>00095 uint32_t <a class="code" href="group__ble__sdk__srv__bas.html#gacb8ac9205dcec39e216575c76261c807" title="Initialize the Battery Service.">ble_bas_init</a>(<a class="code" href="structble__bas__s.html" title="Battery Service structure. This contains various status information for the service.">ble_bas_t</a> * p_bas, <span class="keyword">const</span> <a class="code" href="structble__bas__init__t.html" title="Battery Service init structure. This contains all options and data needed for initialization of the s...">ble_bas_init_t</a> * p_bas_init);
<a name="l00096"></a>00096 
<a name="l00109"></a>00109 <span class="keywordtype">void</span> <a class="code" href="group__ble__sdk__srv__bas.html#ga01b70d77540660d7e312121d9f1d3b3a" title="Battery Service BLE stack event handler.">ble_bas_on_ble_evt</a>(<a class="code" href="structble__bas__s.html" title="Battery Service structure. This contains various status information for the service.">ble_bas_t</a> * p_bas, <a class="code" href="structble__evt__t.html" title="Common BLE Event type, wrapping the module specific event reports.">ble_evt_t</a> * p_ble_evt);
<a name="l00110"></a>00110 
<a name="l00124"></a>00124 uint32_t <a class="code" href="group__ble__sdk__srv__bas.html#ga58d8f4336cce49ea5b3a2f8997bfe00e" title="Update battery level.">ble_bas_battery_level_update</a>(<a class="code" href="structble__bas__s.html" title="Battery Service structure. This contains various status information for the service.">ble_bas_t</a> * p_bas, uint8_t battery_level);
<a name="l00125"></a>00125 
<a name="l00126"></a>00126 <span class="preprocessor">#endif // BLE_BAS_H__</span>
<a name="l00127"></a>00127 <span class="preprocessor"></span>
</pre></div></div>
</div>
  <div id="nav-path" class="navpath">
    <ul>
      <li class="navelem"><a class="el" href="ble__bas_8h.html">ble_bas.h</a>      </li>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
<a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(0)"><span class="SelectionMark">&#160;</span>All</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(1)"><span class="SelectionMark">&#160;</span>Data Structures</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(2)"><span class="SelectionMark">&#160;</span>Files</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(3)"><span class="SelectionMark">&#160;</span>Functions</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(4)"><span class="SelectionMark">&#160;</span>Variables</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(5)"><span class="SelectionMark">&#160;</span>Typedefs</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(6)"><span class="SelectionMark">&#160;</span>Enumerations</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(7)"><span class="SelectionMark">&#160;</span>Enumerator</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(8)"><span class="SelectionMark">&#160;</span>Defines</a></div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>


    <li class="footer">
      Copyright &copy 2006-2011 <a href="http://www.nordicsemi.no" style="text-decoration:none">Nordic Semiconductor</a>.
      All Rights Reserved.
      <a href="disclaimer.html">Disclaimer</a>
    </li>
   </ul>
 </div>


</body>
</html>
